Socket
Socket
Sign inDemoInstall

@jfonx/file-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jfonx/file-utils

Allows you to perform specific operations on files


Version published
Weekly downloads
7.3K
decreased by-34.93%
Maintainers
1
Weekly downloads
 
Created
Source

file-utils

Allows you to perform specific operations on files

Installation

npm install @jfonx/file-utils

Usage

import { findUpJsonFile, toObject, writeFile } from '@jfonx/file-utils';

/* Write a file on the disk */
writeFile({
  file: __dirname + '/filename.txt',
  content: 'I am programmer',
  force: true, // Force rewrite if the file exists
});

/* Read the contents of a JSON file and convert it to an object */
toObject(__dirname + '/tsconfig.json', true /* exit program if error */);

/* Looks for a json file recursively back and stops as soon as the file is found or the root of the hard drive is reached*/
const module = findUpJsonFile({
  filename: 'package.json' /* The desired JSON file */,
  isJson: true,
  rootDir: __dirname /* From this folder */,
});
console.log(module);

FAQs

Package last updated on 11 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc